package org.ym.file.domain.model.rule.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 文件规则类型
 *
 * @author ym
 */
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum RuleType {
    /**
     *
     */
    REG_MATCH("正则匹配", 1), CONTAINS("包含匹配", 2);
    /**
     * name
     */
    private final String name;
    /**
     * key
     */
    private final int code;


    /**
     * 获取枚举
     *
     * @param key key
     * @return RuleType
     */
    public static RuleType getRuleType(int key) {
        switch (key) {
            case 1:
                return REG_MATCH;
            case 2:
                return CONTAINS;
        }
        return null;
    }
}
